<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /fasttmp/mkdist-qt-4.3.5-1211793125/qtopia-core-opensource-src-4.3.5/src/gui/painting/qpolygon.cpp -->
<head>
  <title>Qt 4.3: QPolygonF Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">QPolygonF Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1>
<p>The QPolygonF class provides a vector of points using floating point precision. <a href="#details">More...</a></p>
<pre> #include &lt;QPolygonF&gt;</pre><p>Inherits <a href="qvector.html">QVector&lt;QPointF&gt;</a>.</p>
<p><b>Note:</b> All the functions in this class are <a href="threads.html#reentrant">reentrant</a>.</p>
<ul>
<li><a href="qpolygonf-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h3>Public Functions</h3>
<ul>
<li><div class="fn"/><b><a href="qpolygonf.html#QPolygonF">QPolygonF</a></b> ()</li>
<li><div class="fn"/><b><a href="qpolygonf.html#QPolygonF-2">QPolygonF</a></b> ( int <i>size</i> )</li>
<li><div class="fn"/><b><a href="qpolygonf.html#QPolygonF-3">QPolygonF</a></b> ( const QPolygonF &amp; <i>polygon</i> )</li>
<li><div class="fn"/><b><a href="qpolygonf.html#QPolygonF-4">QPolygonF</a></b> ( const QVector&lt;QPointF&gt; &amp; <i>points</i> )</li>
<li><div class="fn"/><b><a href="qpolygonf.html#QPolygonF-5">QPolygonF</a></b> ( const QRectF &amp; <i>rectangle</i> )</li>
<li><div class="fn"/><b><a href="qpolygonf.html#QPolygonF-6">QPolygonF</a></b> ( const QPolygon &amp; <i>polygon</i> )</li>
<li><div class="fn"/><b><a href="qpolygonf.html#dtor.QPolygonF">~QPolygonF</a></b> ()</li>
<li><div class="fn"/>QRectF <b><a href="qpolygonf.html#boundingRect">boundingRect</a></b> () const</li>
<li><div class="fn"/>bool <b><a href="qpolygonf.html#containsPoint">containsPoint</a></b> ( const QPointF &amp; <i>point</i>, Qt::FillRule <i>fillRule</i> ) const</li>
<li><div class="fn"/>QPolygonF <b><a href="qpolygonf.html#intersected">intersected</a></b> ( const QPolygonF &amp; <i>r</i> ) const</li>
<li><div class="fn"/>bool <b><a href="qpolygonf.html#isClosed">isClosed</a></b> () const</li>
<li><div class="fn"/>QPolygonF <b><a href="qpolygonf.html#subtracted">subtracted</a></b> ( const QPolygonF &amp; <i>r</i> ) const</li>
<li><div class="fn"/>QPolygon <b><a href="qpolygonf.html#toPolygon">toPolygon</a></b> () const</li>
<li><div class="fn"/>void <b><a href="qpolygonf.html#translate">translate</a></b> ( const QPointF &amp; <i>offset</i> )</li>
<li><div class="fn"/>void <b><a href="qpolygonf.html#translate-2">translate</a></b> ( qreal <i>dx</i>, qreal <i>dy</i> )</li>
<li><div class="fn"/>QPolygonF <b><a href="qpolygonf.html#united">united</a></b> ( const QPolygonF &amp; <i>r</i> ) const</li>
</ul>
<ul>
<li><div class="fn"/>62 public functions inherited from <a href="qvector.html#public-functions">QVector</a></li>
</ul>
<a name="related-non-members"></a>
<h3>Related Non-Members</h3>
<ul>
<li><div class="fn"/>QDataStream &amp; <b><a href="qpolygonf.html#operator-lt-lt-88">operator&lt;&lt;</a></b> ( QDataStream &amp; <i>stream</i>, const QPolygonF &amp; <i>polygon</i> )</li>
<li><div class="fn"/>QDataStream &amp; <b><a href="qpolygonf.html#operator-gt-gt-54">operator&gt;&gt;</a></b> ( QDataStream &amp; <i>stream</i>, QPolygonF &amp; <i>polygon</i> )</li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li><div class="fn"/>2 static public members inherited from <a href="qvector.html#static-public-members">QVector</a></li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QPolygonF class provides a vector of points using floating point precision.</p>
<p>A QPolygonF is a <a href="qvector.html">QVector</a>&lt;<a href="qpointf.html">QPointF</a>&gt;. The easiest way to add points to a QPolygonF is to use its streaming operator, as illustrated below:</p>
<pre>         QPolygonF polygon;
         polygon &lt;&lt; QPointF(10.4, 20.5) &lt;&lt; QPointF(20.2, 30.2);</pre>
<p>In addition to the functions provided by <a href="qvector.html">QVector</a>, QPolygonF provides the <a href="qpolygonf.html#boundingRect">boundingRect</a>() and <a href="qpolygonf.html#translate">translate</a>() functions for geometry operations. Use the <a href="qmatrix.html#map">QMatrix::map</a>() function for more general transformations of QPolygonFs.</p>
<p>QPolygonF also provides the <a href="qpolygonf.html#isClosed">isClosed</a>() function to determine whether a polygon's start and end points are the same, and the <a href="qpolygonf.html#toPolygon">toPolygon</a>() function returning an integer precision copy of this polygon.</p>
<p>The QPolygonF class is <a href="shared.html#implicit-data-sharing">implicitly shared</a>.</p>
<p>See also <a href="qvector.html">QVector</a>, <a href="qpolygon.html">QPolygon</a>, and <a href="qlinef.html">QLineF</a>.</p>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="QPolygonF"></a>QPolygonF::QPolygonF ()</h3>
<p>Constructs a polygon with no points.</p>
<p>See also <a href="qvector.html#isEmpty">QVector::isEmpty</a>().</p>
<h3 class="fn"><a name="QPolygonF-2"></a>QPolygonF::QPolygonF ( int <i>size</i> )</h3>
<p>Constructs a polygon of the given <i>size</i>. Creates an empty polygon if <i>size</i> == 0.</p>
<p>See also <a href="qvector.html#isEmpty">QVector::isEmpty</a>().</p>
<h3 class="fn"><a name="QPolygonF-3"></a>QPolygonF::QPolygonF ( const QPolygonF &amp; <i>polygon</i> )</h3>
<p>Constructs a copy of the given <i>polygon</i>.</p>
<h3 class="fn"><a name="QPolygonF-4"></a>QPolygonF::QPolygonF ( const <a href="qvector.html">QVector</a>&lt;<a href="qpointf.html">QPointF</a>&gt; &amp; <i>points</i> )</h3>
<p>Constructs a polygon containing the specified <i>points</i>.</p>
<h3 class="fn"><a name="QPolygonF-5"></a>QPolygonF::QPolygonF ( const <a href="qrectf.html">QRectF</a> &amp; <i>rectangle</i> )</h3>
<p>Constructs a closed polygon from the specified <i>rectangle</i>.</p>
<p>The polygon contains the four vertices of the rectangle in clockwise order starting and ending with the top-left vertex.</p>
<p>See also <a href="qpolygonf.html#isClosed">isClosed</a>().</p>
<h3 class="fn"><a name="QPolygonF-6"></a>QPolygonF::QPolygonF ( const <a href="qpolygon.html">QPolygon</a> &amp; <i>polygon</i> )</h3>
<p>Constructs a float based polygon from the specified integer based <i>polygon</i>.</p>
<p>See also <a href="qpolygonf.html#toPolygon">toPolygon</a>().</p>
<h3 class="fn"><a name="dtor.QPolygonF"></a>QPolygonF::~QPolygonF ()</h3>
<p>Destroys the polygon.</p>
<h3 class="fn"><a name="boundingRect"></a><a href="qrectf.html">QRectF</a> QPolygonF::boundingRect () const</h3>
<p>Returns the bounding rectangle of the polygon, or <a href="qrectf.html">QRectF</a>(0,0,0,0) if the polygon is empty.</p>
<p>See also <a href="qvector.html#isEmpty">QVector::isEmpty</a>().</p>
<h3 class="fn"><a name="containsPoint"></a>bool QPolygonF::containsPoint ( const <a href="qpointf.html">QPointF</a> &amp; <i>point</i>, <a href="qt.html#FillRule-enum">Qt::FillRule</a> <i>fillRule</i> ) const</h3>
<p>Returns true if the given <i>point</i> is inside the polygon according to the specified <i>fillRule</i>; otherwise returns false.</p>
<p>This function was introduced in Qt 4.3.</p>
<h3 class="fn"><a name="intersected"></a>QPolygonF QPolygonF::intersected ( const QPolygonF &amp; <i>r</i> ) const</h3>
<p>Returns a polygon which is the intersection of this polygon and <i>r</i>.</p>
<p>This function was introduced in Qt 4.3.</p>
<h3 class="fn"><a name="isClosed"></a>bool QPolygonF::isClosed () const</h3>
<p>Returns true if the polygon is closed; otherwise returns false.</p>
<p>A polygon is said to be closed if its start point and end point are equal.</p>
<p>See also <a href="qvector.html#first">QVector::first</a>() and <a href="qvector.html#last">QVector::last</a>().</p>
<h3 class="fn"><a name="subtracted"></a>QPolygonF QPolygonF::subtracted ( const QPolygonF &amp; <i>r</i> ) const</h3>
<p>Returns a polygon which is <i>r</i> subtracted from this polygon.</p>
<p>This function was introduced in Qt 4.3.</p>
<h3 class="fn"><a name="toPolygon"></a><a href="qpolygon.html">QPolygon</a> QPolygonF::toPolygon () const</h3>
<p>Creates and returns a <a href="qpolygon.html">QPolygon</a> by converting each <a href="qpointf.html">QPointF</a> to a <a href="qpoint.html">QPoint</a>.</p>
<p>See also <a href="qpointf.html#toPoint">QPointF::toPoint</a>().</p>
<h3 class="fn"><a name="translate"></a>void QPolygonF::translate ( const <a href="qpointf.html">QPointF</a> &amp; <i>offset</i> )</h3>
<p>Translate all points in the polygon by the given <i>offset</i>.</p>
<h3 class="fn"><a name="translate-2"></a>void QPolygonF::translate ( <a href="qtglobal.html#qreal-typedef">qreal</a> <i>dx</i>, <a href="qtglobal.html#qreal-typedef">qreal</a> <i>dy</i> )</h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>Translates all points in the polygon by (<i>dx</i>, <i>dy</i>).</p>
<h3 class="fn"><a name="united"></a>QPolygonF QPolygonF::united ( const QPolygonF &amp; <i>r</i> ) const</h3>
<p>Returns a polygon which is the union of this polygon and <i>r</i>.</p>
<p>This function was introduced in Qt 4.3.</p>
<p>See also <a href="qpolygonf.html#intersected">intersected</a>() and <a href="qpolygonf.html#subtracted">subtracted</a>().</p>
<hr />
<h2>Related Non-Members</h2>
<h3 class="fn"><a name="operator-lt-lt-88"></a><a href="qdatastream.html">QDataStream</a> &amp; operator&lt;&lt; ( <a href="qdatastream.html">QDataStream</a> &amp; <i>stream</i>, const QPolygonF &amp; <i>polygon</i> )</h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>Writes the given <i>polygon</i> to the given <i>stream</i>, and returns a reference to the stream.</p>
<p>See also <a href="datastreamformat.html">Format of the QDataStream Operators</a>.</p>
<h3 class="fn"><a name="operator-gt-gt-54"></a><a href="qdatastream.html">QDataStream</a> &amp; operator&gt;&gt; ( <a href="qdatastream.html">QDataStream</a> &amp; <i>stream</i>, QPolygonF &amp; <i>polygon</i> )</h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>Reads a polygon from the given <i>stream</i> into the given <i>polygon</i>, and returns a reference to the stream.</p>
<p>See also <a href="datastreamformat.html">Format of the QDataStream Operators</a>.</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2008 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.3.5</div></td>
</tr></table></div></address></body>
</html>
